<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>OCILIB (C and C++ Driver for Oracle): Executing statements</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">OCILIB (C and C++ Driver for Oracle)
   &#160;<span id="projectnumber">4.2.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>About</span></a></li>
      <li><a href="modules.html"><span>Documentation</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group___ocilib_c_api_statements.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Executing statements<div class="ingroups"><a class="el" href="group___ocilib_c_api.html">C API</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Executing SQL statements or PL/SQL blocks is really simple with OCILIB.</p>
<p>First, call <a class="el" href="group___ocilib_c_api_statements.html#ga335822f983af0fb5c529431f06a9a17b" title="Create a statement object and return its handle. ">OCI_StatementCreate()</a> to allocate a statement handle. Then :</p>
<ul>
<li>Prepare the SQL with <a class="el" href="group___ocilib_c_api_statements.html#ga592e4b3cf3df7e152c46fab5d6e3b3af" title="Prepare a SQL statement or PL/SQL block. ">OCI_Prepare()</a></li>
<li>Parse and execute it with <a class="el" href="group___ocilib_c_api_statements.html#ga7189aa353845909aaedc8d5956429450" title="Execute a prepared SQL statement or PL/SQL block. ">OCI_Execute()</a></li>
</ul>
<p>These two steps can be done together by calling <a class="el" href="group___ocilib_c_api_statements.html#ga8b2b66994f847d9f0b6b0efe4a13ccf3" title="Prepare and Execute a SQL statement or PL/SQL block. ">OCI_ExecuteStmt()</a> that prepares and executes in one go.</p>
<p>To find out if the statement has affected any rows, call <a class="el" href="group___ocilib_c_api_statements.html#ga1cf932261960da80cd36d650a08565c3" title="Return the number of rows affected by the SQL statement. ">OCI_GetAffectedRows()</a></p>
<p>Finally, release the statement and its resources with <a class="el" href="group___ocilib_c_api_statements.html#ga487b4f90f1fd4aee18f3d901f5aed104" title="Free a statement and all resources associated to it (resultsets ...) ">OCI_StatementFree()</a></p>
<dl class="section note"><dt>Note</dt><dd>A statement can be prepared once and executed as many times as needed (see Binding variables section)</dd>
<dd>
An OCI_Statement can be used to prepare and/or execute different SQL and PL/SQL statements as many times as needed. For example, if the SQL processing of an application is sequential, only one statement handle is required</dd>
<dd>
OCILIB supports nested levels of SQL statement processing. An application can loop through the resultset of the statement handle A, executing statement B and fetching statement C at every loop, and so on ...</dd></dl>
<dl class="section user"><dt>Example</dt><dd><div class="fragment"><div class="line"><span class="preprocessor">#include &quot;ocilib.h&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="group___ocilib_c_api_datatypes.html#ga2135d3b5341ebbaae1f54d62873ecf77">OCI_Connection</a> *cn;</div>
<div class="line">    <a class="code" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a>  *st;</div>
<div class="line">  </div>
<div class="line">    <span class="keywordflow">if</span> (!<a class="code" href="group___ocilib_c_api_initialization.html#ga01464863ddd68393106b63fb8cc1ead1">OCI_Initialize</a>(NULL, NULL, OCI_ENV_DEFAULT))</div>
<div class="line">        <span class="keywordflow">return</span> EXIT_FAILURE;</div>
<div class="line"></div>
<div class="line">    cn = <a class="code" href="group___ocilib_c_api_connections.html#ga5cd867ad94bdc4a3bbfdef24452262e0">OCI_ConnectionCreate</a>(<span class="stringliteral">&quot;db&quot;</span>, <span class="stringliteral">&quot;usr&quot;</span>, <span class="stringliteral">&quot;pwd&quot;</span>, OCI_SESSION_DEFAULT);</div>
<div class="line">    st = <a class="code" href="group___ocilib_c_api_statements.html#ga335822f983af0fb5c529431f06a9a17b">OCI_StatementCreate</a>(cn);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">/* prepare and execute in 2 steps */</span></div>
<div class="line"></div>
<div class="line">    <a class="code" href="group___ocilib_c_api_statements.html#ga592e4b3cf3df7e152c46fab5d6e3b3af">OCI_Prepare</a>(st, <span class="stringliteral">&quot;delete from test_fetch where code &gt; 10&quot;</span>);</div>
<div class="line">    <a class="code" href="group___ocilib_c_api_statements.html#ga7189aa353845909aaedc8d5956429450">OCI_Execute</a>(st);</div>
<div class="line"></div>
<div class="line">    <span class="comment">/* prepare/execute in 1 step */</span></div>
<div class="line"></div>
<div class="line">    <a class="code" href="group___ocilib_c_api_statements.html#ga8b2b66994f847d9f0b6b0efe4a13ccf3">OCI_ExecuteStmt</a>(st, <span class="stringliteral">&quot;delete from test_fetch where code &gt; 1&quot;</span>);</div>
<div class="line"></div>
<div class="line">    printf(<span class="stringliteral">&quot;%d row deleted&quot;</span>, <a class="code" href="group___ocilib_c_api_statements.html#ga1cf932261960da80cd36d650a08565c3">OCI_GetAffectedRows</a>(st));</div>
<div class="line"></div>
<div class="line">    <a class="code" href="group___ocilib_c_api_transactions.html#gaee1ba614ed2dc5bd83bf788ca08f3e71">OCI_Commit</a>(cn);</div>
<div class="line"></div>
<div class="line">    <a class="code" href="group___ocilib_c_api_initialization.html#ga639706aa8e9689c7ebffc018fac6d3ae">OCI_Cleanup</a>();</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">return</span> EXIT_SUCCESS;</div>
<div class="line">}</div>
</div><!-- fragment --> </dd></dl>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga335822f983af0fb5c529431f06a9a17b"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT <a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga335822f983af0fb5c529431f06a9a17b">OCI_StatementCreate</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga2135d3b5341ebbaae1f54d62873ecf77">OCI_Connection</a> *con)</td></tr>
<tr class="memdesc:ga335822f983af0fb5c529431f06a9a17b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a statement object and return its handle.  <a href="#ga335822f983af0fb5c529431f06a9a17b">More...</a><br /></td></tr>
<tr class="separator:ga335822f983af0fb5c529431f06a9a17b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga487b4f90f1fd4aee18f3d901f5aed104"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT boolean OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga487b4f90f1fd4aee18f3d901f5aed104">OCI_StatementFree</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt)</td></tr>
<tr class="memdesc:ga487b4f90f1fd4aee18f3d901f5aed104"><td class="mdescLeft">&#160;</td><td class="mdescRight">Free a statement and all resources associated to it (resultsets ...)  <a href="#ga487b4f90f1fd4aee18f3d901f5aed104">More...</a><br /></td></tr>
<tr class="separator:ga487b4f90f1fd4aee18f3d901f5aed104"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga592e4b3cf3df7e152c46fab5d6e3b3af"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT boolean OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga592e4b3cf3df7e152c46fab5d6e3b3af">OCI_Prepare</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt, const otext *sql)</td></tr>
<tr class="memdesc:ga592e4b3cf3df7e152c46fab5d6e3b3af"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prepare a SQL statement or PL/SQL block.  <a href="#ga592e4b3cf3df7e152c46fab5d6e3b3af">More...</a><br /></td></tr>
<tr class="separator:ga592e4b3cf3df7e152c46fab5d6e3b3af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7189aa353845909aaedc8d5956429450"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT boolean OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga7189aa353845909aaedc8d5956429450">OCI_Execute</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt)</td></tr>
<tr class="memdesc:ga7189aa353845909aaedc8d5956429450"><td class="mdescLeft">&#160;</td><td class="mdescRight">Execute a prepared SQL statement or PL/SQL block.  <a href="#ga7189aa353845909aaedc8d5956429450">More...</a><br /></td></tr>
<tr class="separator:ga7189aa353845909aaedc8d5956429450"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8b2b66994f847d9f0b6b0efe4a13ccf3"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT boolean OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga8b2b66994f847d9f0b6b0efe4a13ccf3">OCI_ExecuteStmt</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt, const otext *sql)</td></tr>
<tr class="memdesc:ga8b2b66994f847d9f0b6b0efe4a13ccf3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Prepare and Execute a SQL statement or PL/SQL block.  <a href="#ga8b2b66994f847d9f0b6b0efe4a13ccf3">More...</a><br /></td></tr>
<tr class="separator:ga8b2b66994f847d9f0b6b0efe4a13ccf3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab8b38d31d356d3ca17640b272bb90401"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT boolean OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#gab8b38d31d356d3ca17640b272bb90401">OCI_Parse</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt, const otext *sql)</td></tr>
<tr class="memdesc:gab8b38d31d356d3ca17640b272bb90401"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parse a SQL statement or PL/SQL block.  <a href="#gab8b38d31d356d3ca17640b272bb90401">More...</a><br /></td></tr>
<tr class="separator:gab8b38d31d356d3ca17640b272bb90401"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga420f21e4b00ce3e35ee15ed1e109ead1"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT boolean OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga420f21e4b00ce3e35ee15ed1e109ead1">OCI_Describe</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt, const otext *sql)</td></tr>
<tr class="memdesc:ga420f21e4b00ce3e35ee15ed1e109ead1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Describe the select list of a SQL select statement.  <a href="#ga420f21e4b00ce3e35ee15ed1e109ead1">More...</a><br /></td></tr>
<tr class="separator:ga420f21e4b00ce3e35ee15ed1e109ead1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabb4eca3a2c07a9f031c3f2f257663da8"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT const otext *OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#gabb4eca3a2c07a9f031c3f2f257663da8">OCI_GetSql</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt)</td></tr>
<tr class="memdesc:gabb4eca3a2c07a9f031c3f2f257663da8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the last SQL or PL/SQL statement prepared or executed by the statement.  <a href="#gabb4eca3a2c07a9f031c3f2f257663da8">More...</a><br /></td></tr>
<tr class="separator:gabb4eca3a2c07a9f031c3f2f257663da8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaddfbdd24d8686d908e560611bb7b6cc7"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT unsigned int OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#gaddfbdd24d8686d908e560611bb7b6cc7">OCI_GetSqlErrorPos</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt)</td></tr>
<tr class="memdesc:gaddfbdd24d8686d908e560611bb7b6cc7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the error position (in terms of characters) in the SQL statement where the error occurred in case of SQL parsing error.  <a href="#gaddfbdd24d8686d908e560611bb7b6cc7">More...</a><br /></td></tr>
<tr class="separator:gaddfbdd24d8686d908e560611bb7b6cc7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1cf932261960da80cd36d650a08565c3"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT unsigned int OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga1cf932261960da80cd36d650a08565c3">OCI_GetAffectedRows</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt)</td></tr>
<tr class="memdesc:ga1cf932261960da80cd36d650a08565c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the number of rows affected by the SQL statement.  <a href="#ga1cf932261960da80cd36d650a08565c3">More...</a><br /></td></tr>
<tr class="separator:ga1cf932261960da80cd36d650a08565c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2927470291ccc2230da272c3573b4879"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT unsigned int OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga2927470291ccc2230da272c3573b4879">OCI_GetSQLCommand</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt)</td></tr>
<tr class="memdesc:ga2927470291ccc2230da272c3573b4879"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the Oracle SQL code the command held by the statement handle.  <a href="#ga2927470291ccc2230da272c3573b4879">More...</a><br /></td></tr>
<tr class="separator:ga2927470291ccc2230da272c3573b4879"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga51c2827c3b5fcfdbd768b8c7e1c1cbc3"><td class="memItemLeft" align="right" valign="top">OCI_EXPORT const otext *OCI_API&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___ocilib_c_api_statements.html#ga51c2827c3b5fcfdbd768b8c7e1c1cbc3">OCI_GetSQLVerb</a> (<a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *stmt)</td></tr>
<tr class="memdesc:ga51c2827c3b5fcfdbd768b8c7e1c1cbc3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the verb of the SQL command held by the statement handle.  <a href="#ga51c2827c3b5fcfdbd768b8c7e1c1cbc3">More...</a><br /></td></tr>
<tr class="separator:ga51c2827c3b5fcfdbd768b8c7e1c1cbc3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga335822f983af0fb5c529431f06a9a17b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT <a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a>* OCI_API OCI_StatementCreate </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga2135d3b5341ebbaae1f54d62873ecf77">OCI_Connection</a> *&#160;</td>
          <td class="paramname"><em>con</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Create a statement object and return its handle. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">con</td><td>- Connection handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A statement handle on success otherwise NULL </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#a04d273b9516f7ebf7d9c326df3f36697">ocilib::Statement::Statement()</a>.</p>

</div>
</div>
<a class="anchor" id="ga487b4f90f1fd4aee18f3d901f5aed104"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT boolean OCI_API OCI_StatementFree </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Free a statement and all resources associated to it (resultsets ...) </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Connection handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>TRUE on success otherwise FALSE </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#a04d273b9516f7ebf7d9c326df3f36697">ocilib::Statement::Statement()</a>.</p>

</div>
</div>
<a class="anchor" id="ga592e4b3cf3df7e152c46fab5d6e3b3af"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT boolean OCI_API OCI_Prepare </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const otext *&#160;</td>
          <td class="paramname"><em>sql</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Prepare a SQL statement or PL/SQL block. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle </td></tr>
    <tr><td class="paramname">sql</td><td>- SQL order or PL/SQL block</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>Do not call this function for fetched statements (REF cursors)</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>TRUE on success otherwise FALSE </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#a86e2443467c373530fc5a6a1e4e84e36">ocilib::Statement::Prepare()</a>.</p>

</div>
</div>
<a class="anchor" id="ga7189aa353845909aaedc8d5956429450"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT boolean OCI_API OCI_Execute </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Execute a prepared SQL statement or PL/SQL block. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>TRUE on success otherwise FALSE</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>If a SQL warning occurs:<ul>
<li>the function returns TRUE</li>
<li>the SQL warning triggers the global error handler with an OCI_Error having its <a class="el" href="group___ocilib_c_api_error_handling.html#ga66d447c8cd06ea3f841b439a1aac055b" title="Retrieve the type of error from error handle. ">OCI_ErrorGetType()</a> attribute set to OCI_ERR_WARNING</li>
<li>If OCILIB is initialized with the OCI_ENV_CONTEXT mode, <a class="el" href="group___ocilib_c_api_error_handling.html#gaf2abe52ad5b278f65dd97a44a2adac4c" title="Retrieve the last error or warning occurred within the last OCILIB call. ">OCI_GetLastError()</a> will return the OCI_Error object corresponding to the warning </li>
</ul>
</dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#ade72a9bde1660483c15e36a49787e140">ocilib::Statement::ExecutePrepared()</a>.</p>

</div>
</div>
<a class="anchor" id="ga8b2b66994f847d9f0b6b0efe4a13ccf3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT boolean OCI_API OCI_ExecuteStmt </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const otext *&#160;</td>
          <td class="paramname"><em>sql</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Prepare and Execute a SQL statement or PL/SQL block. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle </td></tr>
    <tr><td class="paramname">sql</td><td>- SQL order - PL/SQL block</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>TRUE on success otherwise FALSE</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>If a SQL warning occurs:<ul>
<li>the function returns TRUE</li>
<li>the SQL warning triggers the global error handler with an OCI_Error having its <a class="el" href="group___ocilib_c_api_error_handling.html#ga66d447c8cd06ea3f841b439a1aac055b" title="Retrieve the type of error from error handle. ">OCI_ErrorGetType()</a> attribute set to OCI_ERR_WARNING</li>
<li>If OCILIB is initialized with the OCI_ENV_CONTEXT mode, <a class="el" href="group___ocilib_c_api_error_handling.html#gaf2abe52ad5b278f65dd97a44a2adac4c" title="Retrieve the last error or warning occurred within the last OCILIB call. ">OCI_GetLastError()</a> will return the OCI_Error object corresponding to the warning </li>
</ul>
</dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#a4dfa7fef7a945dd5242cd9b0d24385e6">ocilib::Statement::Execute()</a>.</p>

</div>
</div>
<a class="anchor" id="gab8b38d31d356d3ca17640b272bb90401"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT boolean OCI_API OCI_Parse </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const otext *&#160;</td>
          <td class="paramname"><em>sql</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Parse a SQL statement or PL/SQL block. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle </td></tr>
    <tr><td class="paramname">sql</td><td>- SQL order - PL/SQL block</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This call sends the SQL or PL/SQL command to the server for parsing only. The command is not executed. This call is only useful to check is a command is valid or not.</dd>
<dd>
This call prepares the statement (internal call to <a class="el" href="group___ocilib_c_api_statements.html#ga592e4b3cf3df7e152c46fab5d6e3b3af" title="Prepare a SQL statement or PL/SQL block. ">OCI_Prepare()</a>) and ask the Oracle server to parse its SQL or PL/SQL command. <a class="el" href="group___ocilib_c_api_statements.html#ga7189aa353845909aaedc8d5956429450" title="Execute a prepared SQL statement or PL/SQL block. ">OCI_Execute()</a> can be call after <a class="el" href="group___ocilib_c_api_statements.html#gab8b38d31d356d3ca17640b272bb90401" title="Parse a SQL statement or PL/SQL block. ">OCI_Parse()</a> in order to execute the statement, which means that the server will re-parse again the command.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>Do not use <a class="el" href="group___ocilib_c_api_statements.html#gab8b38d31d356d3ca17640b272bb90401" title="Parse a SQL statement or PL/SQL block. ">OCI_Parse()</a> unless you're only interested in the parsing result because the statement will be parsed again when executed and thus leading to unnecessary server round-trips and less performance</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>TRUE on success otherwise FALSE </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#aa13843de1251c79b09a1329b40d41d42">ocilib::Statement::Parse()</a>.</p>

</div>
</div>
<a class="anchor" id="ga420f21e4b00ce3e35ee15ed1e109ead1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT boolean OCI_API OCI_Describe </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const otext *&#160;</td>
          <td class="paramname"><em>sql</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Describe the select list of a SQL select statement. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle </td></tr>
    <tr><td class="paramname">sql</td><td>- SELECT sql statement</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This call sends the SELECT SQL order to the server for retrieving the description of the select order only. The command is not executed. This call is only useful to retrieve information on the associated resultset Call OCI_GetResultet() after <a class="el" href="group___ocilib_c_api_statements.html#ga420f21e4b00ce3e35ee15ed1e109ead1" title="Describe the select list of a SQL select statement. ">OCI_Describe()</a> to access to SELECT list information</dd>
<dd>
This call prepares the statement (internal call to <a class="el" href="group___ocilib_c_api_statements.html#ga592e4b3cf3df7e152c46fab5d6e3b3af" title="Prepare a SQL statement or PL/SQL block. ">OCI_Prepare()</a>) and ask the Oracle server to describe the output SELECT list. <a class="el" href="group___ocilib_c_api_statements.html#ga7189aa353845909aaedc8d5956429450" title="Execute a prepared SQL statement or PL/SQL block. ">OCI_Execute()</a> can be called after OCI_Desbribe() in order to execute the statement, which means that the server will parse, and describe again the SQL order.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>Do not use OCI_Desbribe() unless you're only interested in the resultset information because the statement will be parsed again when executed and thus leading to unnecessary server round-trips and less performance</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>TRUE on success otherwise FALSE </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#ac967f297cfd4ca08f431c647c2fdc793">ocilib::Statement::Describe()</a>.</p>

</div>
</div>
<a class="anchor" id="gabb4eca3a2c07a9f031c3f2f257663da8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT const otext* OCI_API OCI_GetSql </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Return the last SQL or PL/SQL statement prepared or executed by the statement. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#a4146261dc85bb823659bc0f3d2ca102e">ocilib::Statement::GetSql()</a>.</p>

</div>
</div>
<a class="anchor" id="gaddfbdd24d8686d908e560611bb7b6cc7"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT unsigned int OCI_API OCI_GetSqlErrorPos </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Return the error position (in terms of characters) in the SQL statement where the error occurred in case of SQL parsing error. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>Positions start at 1. </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#a555c93ed148f37baa9ba7d4eee8e772e">ocilib::Statement::GetSqlErrorPos()</a>.</p>

</div>
</div>
<a class="anchor" id="ga1cf932261960da80cd36d650a08565c3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT unsigned int OCI_API OCI_GetAffectedRows </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Return the number of rows affected by the SQL statement. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle</td></tr>
  </table>
  </dd>
</dl>
<p>The returned value is :</p><ul>
<li>For UPDATEs : number of rows updated</li>
<li>For INSERTs : number of rows inserted</li>
<li>For DELETEs : number of rows deleted</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>For SELECTs statements, use <a class="el" href="group___ocilib_c_api_fetching.html#ga93bd9197720088dbda2bef593ad1c07c" title="Retrieve the number of rows fetched so far. ">OCI_GetRowCount()</a> instead </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#a5e268232a710bf97f711f74dddc9c134">ocilib::Statement::GetAffectedRows()</a>.</p>

</div>
</div>
<a class="anchor" id="ga2927470291ccc2230da272c3573b4879"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT unsigned int OCI_API OCI_GetSQLCommand </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Return the Oracle SQL code the command held by the statement handle. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd><a class="el" href="group___ocilib_c_api_statements.html#ga2927470291ccc2230da272c3573b4879" title="Return the Oracle SQL code the command held by the statement handle. ">OCI_GetSQLCommand()</a> must be called after the statement has be executed because that's the server engine that computes the SQL command code</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>The SQL command code of the statement otherwise OCI_UNKOWN </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#afe07d4cf0261db028b385ec1a3faaa1d">ocilib::Statement::GetSQLCommand()</a>.</p>

</div>
</div>
<a class="anchor" id="ga51c2827c3b5fcfdbd768b8c7e1c1cbc3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OCI_EXPORT const otext* OCI_API OCI_GetSQLVerb </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group___ocilib_c_api_datatypes.html#ga4b016f1bd7de508b1a919e34b12aa83d">OCI_Statement</a> *&#160;</td>
          <td class="paramname"><em>stmt</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;ocilib.h&gt;</code></p>

<p>Return the verb of the SQL command held by the statement handle. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">stmt</td><td>- Statement handle</td></tr>
  </table>
  </dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd><a class="el" href="group___ocilib_c_api_statements.html#ga51c2827c3b5fcfdbd768b8c7e1c1cbc3" title="Return the verb of the SQL command held by the statement handle. ">OCI_GetSQLVerb()</a> must be called after the statement has been executed because that's the server engine that computes the SQL verb</dd></dl>
<dl class="section note"><dt>Note</dt><dd>The SQL verb list is available in Oracle documentations and guides</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>The SQL command verb of the statement otherwise NULL </dd></dl>

<p>Referenced by <a class="el" href="classocilib_1_1_statement.html#ab7a0e67ac119938a0e115b8a1e8635db">ocilib::Statement::GetSQLVerb()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Mon Mar 21 2016 22:26:36 for OCILIB (C and C++ Driver for Oracle) by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
  </ul>
</div>
</body>
</html>
